package com.ufenlei.alarm
{
	public class TimePeriod
	{
		public var time:uint;
		/* ms : 输入时间段的"秒数" */
		public function TimePeriod(s:Number ):void
		{
			this.time = s/1000;
		}
		public function getYear():uint{
			return time/(60*60*24*365);
		}
		public function getDay():uint{
			return (time%(60*60*24*365))/(60*60*24);
		}
		public function getHour():uint{
			return (time%(60*60*24))/(60*60);
		}
		public function getMinite():uint{
			return (time%(60*60))/60;
		}
		public function getSecond():uint{
			return time%60;
		}
		public function getPeriod():String{
			var output:String = '在';
			output += this.getYear()?this.getYear()+" 年 ":"";
			output += this.getDay()?this.getDay()+" 天 ":"";
			if(this.getYear()>1||this.getDay()>5) return output;
			output += this.getHour()?this.getHour()+" 小时 ":"";
			output += this.getMinite()?this.getMinite()+" 分 ":"";
			output += this.getSecond()?this.getSecond()+" 秒 ":"";
			return output+"后";
		}

	}
}